<template>
  <div>
    <div class="gva-search-box">
      <el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
      <el-form-item label="创建日期" prop="createdAt">
      <template #label>
        <span>
          创建日期
          <el-tooltip content="搜索范围是开始日期（包含）至结束日期（不包含）">
            <el-icon><QuestionFilled /></el-icon>
          </el-tooltip>
        </span>
      </template>
      <el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期" :disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
       —
      <el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期" :disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
      </el-form-item>
      <el-form-item label="订单ID" prop="orderId">
         <el-input v-model="searchInfo.orderId" placeholder="订单号" />
      </el-form-item>
      <el-form-item label="头条计划ID" prop="promotionId">
        <el-input v-model="searchInfo.promotionId" placeholder="计划id" />
      </el-form-item>
      <el-form-item label="回传状态" prop="convStatusParam">
        <el-select
            v-model="searchInfo.convStatusParam"
            filterable
            allow-create
            placeholder="请选择"
            style="width: 240px !important"
          >
            <el-option label="未回传" value="0" />
            <el-option label="自动回传" value="1" />
            <el-option label="手动回传" value="2" />
          </el-select>
      </el-form-item>
           <el-form-item label="支付状态" prop="payStatus">
            <el-select
                v-model="searchInfo.payStatus"
                filterable
                allow-create
                placeholder="请选择"
                style="width: 240px !important"
              >
                <el-option label="未支付" value="1" />
                <el-option label="已支付" value="2" />
              </el-select>
          </el-form-item>
          <el-form-item label="是否首充" prop="isFirstOrder">
            <el-select
                v-model="searchInfo.isFirstOrder"
                filterable
                allow-create
                placeholder="请选择"
                style="width: 240px !important"
              >
                <el-option label="是" value="1" />
              </el-select>
         </el-form-item>
         <el-form-item label="平台类型：" prop="platId">
            <el-select v-model="searchInfo.platId" clearable placeholder="请选择" @clear="()=>{searchInfo.platId=0}">
              <el-option v-for="(item,key) in platOptions" :key="key" :label="item.label" :value="item.value" />
            </el-select>
            </el-form-item>
         
      <el-input v-model="searchInfo.referralId" :clearable="true" v-if="show" />
      <el-input v-model="searchInfo.movieName" :clearable="true" v-if="show" />
        <el-form-item>
          <el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
          <el-button icon="refresh" @click="onReset">重置</el-button>
          <el-button type="success" @click="allExport" v-show="true" >导出表格</el-button>

        </el-form-item>
      </el-form>
    </div>
    <div class="gva-table-box">
        <el-table
        ref="multipleTable"
        style="width: 100%"
        tooltip-effect="dark"
        :data="tableData"
        row-key="ID"
        height="570"
        @selection-change="handleSelectionChange"
        >
        <el-table-column align="left" label="平台类型" prop="platId" width="120">
            <template #default="scope">
            {{ filterDict(scope.row.platId,platOptions) }}
            </template>
        </el-table-column>
        <el-table-column align="left" label="应用名称"  prop="appName" width="80" />
        <el-table-column align="left" label="推广名称"  prop="referralName" width="80" />
        <el-table-column align="left" label="用户标识"  prop="userId"  width="80" />
        <el-table-column align="left" label="是否首充" prop="isItTopUp" width="80" />
        <el-table-column align="left" label="充值次数" prop="rechargeTimes" width="80" />
        <el-table-column align="left" label="计划ID" prop="promotionId" width="80"  />
        <el-table-column align="left" label="回传状态" prop="convStatus" width="130" >
          <template #default="scope">
            <el-button @click="convManual(scope.row)" type="primary" v-if="scope.row.convStatus==0&&scope.row.payStatus=='已支付'">可手动上报</el-button>
            <el-button  type="success" text  v-else-if="scope.row.convStatus==1" >已上报回传</el-button>
            <el-button  type="warning" text v-else-if="scope.row.convStatus==2">已手动上报</el-button>
            <el-button  type="info" text v-else >不可上报</el-button>
          </template>
        </el-table-column>
        <el-table-column align="left" label="订单ID" prop="orderId" width="100" />
        <el-table-column align="left" label="渠道id" prop="channelId" width="80" />
        <!-- <el-table-column align="left" label="推广id" prop="referralId" width="80" /> -->
        <el-table-column align="left" label="产品名字" prop="productName" width="100" />
        <el-table-column align="left" label="产品类型" prop="productType" width="100" />
        <el-table-column align="left" label="金额(元)" prop="productCost" width="80" />
        <el-table-column align="left" label="累计充值/元" prop="rechargeSumByUser" width="80" />
        <el-table-column align="left" label="看点(个)" prop="productAmount" width="80" />
        <el-table-column align="left" label="VIP(天)" prop="productAmountV1" width="80" />
        <el-table-column align="left" label="赠送金额" prop="productGive" width="80" />
        <el-table-column align="left" label="短剧名称" prop="movieName" width="80" />
        <!-- <el-table-column align="left" label="短剧剧集id" prop="episodeId" width="100" /> -->
        <el-table-column align="left" label="支付状态" prop="payStatus" width="80" />
        <el-table-column align="left" label="支付平台" prop="isIOS" width="80" >
          <template #default="scope">{{  scope.row.isIOS>0 ?"IOS": "默认"}}</template>
        </el-table-column>

        <!-- <el-table-column align="left" label="回传状态" prop="backStatus" width="80" /> -->
        <el-table-column align="left" label="用户激活时间" prop="activationTime" width="120" />
         <el-table-column align="left" label="创建时间" width="120">
            <template #default="scope">{{ formatDate(scope.row.createTime) }}</template>
         </el-table-column>
         <el-table-column align="left" label="更新时间" width="120">
            <template #default="scope">{{ formatDate(scope.row.updateTime) }}</template>
         </el-table-column>
        </el-table>
        <div class="gva-pagination">
            <el-pagination
            layout="total, sizes, prev, pager, next, jumper"
            :current-page="page"
            :page-size="pageSize"
            :page-sizes="[10, 30, 50, 100]"
            :total="total"
            @current-change="handleCurrentChange"
            @size-change="handleSizeChange"
            />
        </div>
    </div>
  </div>
</template>

<script setup>
import {
  createTRecharge,
  deleteTRecharge,
  deleteTRechargeByIds,
  updateTRecharge,
  findTRecharge,
  getTRechargeList,
  getTRechargeAllListToExport,
} from '@/api/tRecharge'

import {
  convOrderManualByOrderId,
} from '@/api/tAdConvOrder'

// 全量引入格式化工具 请按需保留
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
import { ref, reactive,toRefs } from 'vue'

import table2Excel from 'js-table2excel' // 引入  js-table2excel
// import * as XLSX from "xlsx" // 引入  xlsx

import { useRoute, useRouter } from "vue-router"

const props = defineProps({
  row: {
    default: function() {
      return {}
    },
    type: Object
  }
})


defineOptions({
    name: 'TRecharge'
})

const route = useRoute()
const router = useRouter()


// 自动化生成的字典（可能为空）以及字段
const platOptions = ref([])
const formData = ref({
        userId: '',
        orderId: '',
        platId: 0,
        appId: '',
        version: '',
        channelId: '',
        referralId: '',
        clientIp: '',
        deviceId: '',
        productId: '',
        productName: '',
        productType: 0,
        productCost: 0,
        productAmount: 0,
        productGive: 0,
        movieId: 0,
        episodeId: 0,
        seq: 0,
        payType: 0,
        payStatus: 0,
        payTypeVirtualWechat: 0,
        trace: '',
        thirdOrderId: '',
        createTime: new Date(),
        updateTime: new Date(),
        })


// 验证规则
const rule = reactive({
})

const searchRule = reactive({
  createdAt: [
    { validator: (rule, value, callback) => {
      if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
        callback(new Error('请填写结束日期'))
      } else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
        callback(new Error('请填写开始日期'))
      } else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
        callback(new Error('开始日期应当早于结束日期'))
      } else {
        callback()
      }
    }, trigger: 'change' }
  ],
})

const elFormRef = ref()
const elSearchFormRef = ref()

// =========== 表格控制部分 ===========
const page = ref(1)
const total = ref(0)
const pageSize = ref(10)
const tableData = ref([])
const searchInfo = ref({
  referralId: props.row.ID,
  // movieName: props.row.movieName
})


// 重置
const onReset = () => {
  searchInfo.value = {}
  searchInfo.value.referralId = props.row.ID
  getTableData()
}

// 搜索
const onSubmit = () => {
  elSearchFormRef.value?.validate(async(valid) => {
    if (!valid) return
    page.value = 1
    pageSize.value = 10
    getTableData()
  })
}

// 分页
const handleSizeChange = (val) => {
  pageSize.value = val
  getTableData()
}

// 修改页面容量
const handleCurrentChange = (val) => {
  page.value = val
  getTableData()
}

// 查询
const getTableData = async() => {
  const table = await getTRechargeList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
  if (table.code === 0) {
    // 定义金额数组
    var dataList = []
    // 累计金额
    for(var j = 0; j < table.data.list.length; j++){
      table.data.list[j].payCount = 0
      // 判断支付状态 == 2 的时候，已支付
      if(table.data.list[j].payStatus == 2){
        var addFlag=true
        if(dataList.length > 0){
          for(var i=0; i < dataList.length; i++){
            if(dataList[i].userId == table.data.list[j].userId){
              addFlag=false
              userInfo.payCount += table.data.list[j].productCost 
            }
          }
        }
        if(addFlag){
          var userInfo={}
          userInfo.userId = table.data.list[j].userId,
          userInfo.payCount = table.data.list[j].productCost
          dataList.push(userInfo)
        }
      }
    }
    for(var i =0; i<table.data.list.length; i++){
      if(table.data.list[i].payStatus == 1){
        table.data.list[i].payStatus = "未支付"
        table.data.list[i].rechargeTimes = "-"
        table.data.list[i].isItTopUp ="否"
        table.data.list[i].payCount = table.data.list[i].productCost / 100
        // 累计充值金额
        table.data.list[i].countProductCost = table.data.list[i].productCost / 100
      }else if(table.data.list[i].payStatus == 2){
         table.data.list[i].payStatus = "已支付"
        // 充值次数
        table.data.list[i].rechargeTimes = "第"+  table.data.list[i].rechargeTimes +"次充值"
        // 是否首充,判断不同用户首充问题
        if(table.data.list[i].rechargeTimes == "第1次充值"){    
          table.data.list[i].isItTopUp ="是"
        } else {
          table.data.list[i].isItTopUp ="否"
      }
        dataList.forEach(function(item){
          if(item.userId == table.data.list[i].userId){
          // 状态为已支付的累计充值金额
          table.data.list[i].payCount = (item.payCount / 100).toFixed(2)
          }
        })
      }
      if(table.data.list[i].productType == 1){
         table.data.list[i].productType = "看点"
         // 如果产品类型==看点
         table.data.list[i].productAmount = table.data.list[i].productAmount 
         table.data.list[i].productAmountV1 = '-'
        } else if(table.data.list[i].productType == 2){
         table.data.list[i].productType = "VIP"
        // 换算成天
        table.data.list[i].productAmountV1 = (table.data.list[i].productAmount / 86400).toFixed(0)
        table.data.list[i].productAmount = '-'
      }
  
      // 应用名称
      if (table.data.list[i].appId == "com.mbwx.yueshu"){
        table.data.list[i].appName = "音漫剧场"
      }
      if (table.data.list[i].appId == "com.mbwx.yiman"){
        table.data.list[i].appName = "一漫剧场"
      }
      if (table.data.list[i].appId == "com.wyxh.wanyi"){
        table.data.list[i].appName = "万亿剧场"
      }
      // 金额换算为元
      table.data.list[i].productCost =  table.data.list[i].productCost / 100
      // 短剧名称
      table.data.list[i].movieId = searchInfo.value.movieName
      // 金额换算为元
      table.data.list[i].rechargeSumByUser =  (table.data.list[i].rechargeSumByUser / 100).toFixed(2)
    }
    for(var j = 0; j < table.data.list.length; j++){
      if(table.data.list[j].payStatus == "已支付"){
      }
    }
    tableData.value = table.data.list
    total.value = table.data.total
    page.value = table.data.page
    pageSize.value = table.data.pageSize
  }
}

getTableData()

// ============== 表格控制部分结束 ===============

// 获取需要的字典 可能为空 按需保留
const setOptions = async () =>{
  platOptions.value = await getDictFunc('plat')
}

// 获取需要的字典 可能为空 按需保留
setOptions()


// 多选数据
const multipleSelection = ref([])
// 多选
const handleSelectionChange = (val) => {
    multipleSelection.value = val
}

// 删除行
const deleteRow = (row) => {
    ElMessageBox.confirm('确定要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
            deleteTRechargeFunc(row)
        })
    }


// 批量删除控制标记
const deleteVisible = ref(false)

// 多选删除
const onDelete = async() => {
      const ids = []
      if (multipleSelection.value.length === 0) {
        ElMessage({
          type: 'warning',
          message: '请选择要删除的数据'
        })
        return
      }
      multipleSelection.value &&
        multipleSelection.value.map(item => {
          ids.push(item.ID)
        })
      const res = await deleteTRechargeByIds({ ids })
      if (res.code === 0) {
        ElMessage({
          type: 'success',
          message: '删除成功'
        })
        if (tableData.value.length === ids.length && page.value > 1) {
          page.value--
        }
        deleteVisible.value = false
        getTableData()
      }
    }

// 行为控制标记（弹窗内部需要增还是改）
const type = ref('')

// 更新行
const updateTRechargeFunc = async(row) => {
    const res = await findTRecharge({ ID: row.ID })
    type.value = 'update'
    if (res.code === 0) {
        formData.value = res.data.retRecharge
        dialogFormVisible.value = true
    }
}


// 删除行
const deleteTRechargeFunc = async (row) => {
    const res = await deleteTRecharge({ ID: row.ID })
    if (res.code === 0) {
        ElMessage({
                type: 'success',
                message: '删除成功'
            })
            if (tableData.value.length === 1 && page.value > 1) {
            page.value--
        }
        getTableData()
    }
}

// 弹窗控制标记
const dialogFormVisible = ref(false)


// 查看详情控制标记
const detailShow = ref(false)


// 打开详情弹窗
const openDetailShow = () => {
  detailShow.value = true
}


// 打开详情
const getDetails = async (row) => {
  // 打开弹窗
  const res = await findTRecharge({ ID: row.ID })
  if (res.code === 0) {
    formData.value = res.data.retRecharge
    openDetailShow()
  }
}


// 关闭详情弹窗
const closeDetailShow = () => {
  detailShow.value = false
  formData.value = {
          userId: '',
          orderId: '',
          platId: 0,
          appId: '',
          version: '',
          channelId: '',
          referralId: '',
          clientIp: '',
          deviceId: '',
          productId: '',
          productName: '',
          productType: 0,
          productCost: 0,
          productAmount: 0,
          productGive: 0,
          movieId: 0,
          episodeId: 0,
          seq: 0,
          payType: 0,
          payStatus: 0,
          payTypeVirtualWechat: 0,
          trace: '',
          thirdOrderId: '',
          createTime: new Date(),
          updateTime: new Date(),
          }
}


// 打开弹窗
const openDialog = () => {
    type.value = 'create'
    dialogFormVisible.value = true
}

// 关闭弹窗
const closeDialog = () => {
    dialogFormVisible.value = false
    formData.value = {
        userId: '',
        orderId: '',
        platId: 0,
        appId: '',
        version: '',
        channelId: '',
        referralId: '',
        clientIp: '',
        deviceId: '',
        productId: '',
        productName: '',
        productType: 0,
        productCost: 0,
        productAmount: 0,
        productGive: 0,
        movieId: 0,
        episodeId: 0,
        seq: 0,
        payType: 0,
        payStatus: 0,
        payTypeVirtualWechat: 0,
        trace: '',
        thirdOrderId: '',
        createTime: new Date(),
        updateTime: new Date(),
        }
}
// 弹窗确定
const enterDialog = async () => {
     elFormRef.value?.validate( async (valid) => {
             if (!valid) return
              let res
              switch (type.value) {
                case 'create':
                  res = await createTRecharge(formData.value)
                  break
                case 'update':
                  res = await updateTRecharge(formData.value)
                  break
                default:
                  res = await createTRecharge(formData.value)
                  break
              }
              if (res.code === 0) {
                ElMessage({
                  type: 'success',
                  message: '创建/更改成功'
                })
                closeDialog()
                getTableData()
              }
      })
}


// 手动回传触发
const convManual = (row) => {
    ElMessageBox.confirm('确定要手动回传吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
      convManualFunc(row)
        })
    }
// 手动回传接口处理
const convManualFunc = async (row) => {
    const res = await convOrderManualByOrderId({ OrderId: row.orderId })
    if (res.code === 0) {
        ElMessage({
                type: 'success',
                message: '回传成功'
            })
      }
    getTableData()
}


const state = reactive({
  tableData1: [ // 模拟请求数据
    {
      date: '2022/11/12 10:16:56',
      name: 'Tom',
      address: 'No. 189, Grove St, Los Angeles',
      age: 1
    },
    {
      date: '2022/11/12 10:16:56',
      name: 'Tom',
      address: 'No. 189, Grove St, Los Angeles',
      age: 1
    },
    {
      date: '2022/11/12 10:16:56',
      name: 'Tom',
      address: 'No. 189, Grove St, Los Angeles',
      age: 2
    },
    {
      date: '2022/11/12 10:16:56',
      name: 'Tom',
      address: 'No. 189, Grove St, Los Angeles',
      age: 2
    },
  ],
  exportConfig: [ // 导出Excel表格配置
    {
      title: '应用名称',
      key: 'appName',
      type: 'text'
    },
    {
      title: '推广名称',
      key: 'referralName',
      type: 'text'
    },
    {
      title: '用户标识',
      key: 'userId',
      type: 'text'
    },
    {
      title: '是否首充',
      key: 'isItTopUp',
      type: 'text'
    },
    {
      title: '充值次数',
      key: 'rechargeTimes',
      type: 'text'
    },
    {
      title: '计划ID',
      key: 'promotionId',
      type: 'text',
      width: '400',
    },
    {
      title: '回传状态',
      key: 'convStatus',
      type: 'text'
    },
    {
      title: '订单编号',
      key: 'orderId',
      type: 'text'
    },
    {
      title: '渠道id',
      key: 'channelId',
      type: 'text'
    },
    {
      title: '产品名称',
      key: 'productName',
      type: 'text'
    },
    {
      title: '产品类型',
      key: 'productType',
      type: 'text'
    }, 
    {
      title: '金额(元)',
      key: 'productCost',
      type: 'text'
    },
    {
      title: '累计充值/元',
      key: 'rechargeSumByUser',
      type: 'text'
    },
    {
      title: '看点(个)',
      key: 'productAmount',
      type: 'text'
    },
    {
      title: 'VIP(天)',
      key: 'productAmountV1',
      type: 'text'
    },
    {
      title: '赠送金额',
      key: 'productGive',
      type: 'text'
    },
    {
      title: '短剧名称',
      key: 'movieName',
      type: 'text'
    },
    {
      title: '支付状态',
      key: 'payStatus',
      type: 'text'
    },
    {
      title: '支付平台',
      key: 'isIOS',
      type: 'text'
    },
    {
      title: '用户激活时间',
      key: 'activationTime',
      type: 'text'
    },
    {
      title: '创建时间',
      key: 'createTime',
      type: 'text'
    },
    {
      title: '更新时间',
      key: 'updateTime',
      type: 'text'
    },
    /*x`
    { 导出图片这样配置，type为image
      title: '头像',
      key: 'avatar',
      type: 'image'
    },
    */
  ],
  formatColumns: [ // 导出特殊字段处理
    {
      prop: 'productType', // 产品类型
      option: {
        '1': '看点',
        '2': 'VIP'
      },
    },
    {
      prop: 'payStatus', // 支付状态
      option: {
         '1': '未支付',
         '2': '已支付'
      },
    },
    {
      prop: 'isIOS', // 支付状态
      option: {
         '0': '默认',
         '1': 'IOS'
      },
    },
  ]
})

const { tableData1, exportConfig, formatColumns } = toRefs(state)

const tableRef = ref()


// 所有数据导出
const allExport = async () => {
  ElMessageBox.close() // 关闭弹出框
  const loading = ElLoading.service({ // 打开遮罩层
    lock: true,
    text: '请稍等...',
    background: 'rgba(255, 255, 255, 0.5)',
  })
    // 这里是去调后台接口，拿到需要导出的所有数据
    const res = await getTRechargeAllListToExport({ ...searchInfo.value })
    if(res.data.list.length > 0){
      for(var i= 0; i<res.data.list.length; i++){
        if (res.data.list[i].appId == "com.mbwx.yueshu"){
          res.data.list[i].appName = "音漫剧场"
        }
        if (res.data.list[i].appId == "com.mbwx.yiman"){
          res.data.list[i].appName = "一漫剧场"
        }
        if (res.data.list[i].appId == "com.wyxh.wanyi"){
          res.data.list[i].appName = "万亿剧场"
        }
      // 是否首充
      if(res.data.list[i].rechargeTimes == 1){    
          res.data.list[i].isItTopUp ="是"
        } else {
          res.data.list[i].isItTopUp ="否"
      }
      // 充值次数(第几次充值)
      res.data.list[i].rechargeTimes = "第"+  res.data.list[i].rechargeTimes +"次充值"
      // 短剧名称
      res.data.list[i].movieId = searchInfo.value.movieName
      // 用户激活时间
      res.data.list[i].activationTime = res.data.list[i].activationTime
      // 计划ID
      res.data.list[i].promotionId = res.data.list[i].promotionId
      // 累计充值  金额换算为元
      res.data.list[i].rechargeSumByUser = (res.data.list[i].rechargeSumByUser / 100).toFixed(2)
      // 金额元(保留两位小数)
      res.data.list[i].productCost =  res.data.list[i].productCost / 100
     // 回传状态
      if(res.data.list[i].convStatus == 0 && res.data.list[i].payStatus == 2){
        res.data.list[i].convStatus = "可手动上报" 
      }else if(res.data.list[i].convStatus == 1){
        res.data.list[i].convStatus = "已上传回传" 
      }else if(res.data.list[i].convStatus == 2){
        res.data.list[i].convStatus = "已手动上报" 
      }else{
        res.data.list[i].convStatus = "不可上报"  
      }
     // 看点/vip天数
     if(res.data.list[i].productType == 1){
         res.data.list[i].productAmount = res.data.list[i].productAmount 
         res.data.list[i].productAmountV1 = '-'
    }else if(res.data.list[i].productType == 2){
          // 换算成天
        res.data.list[i].productAmountV1 = (res.data.list[i].productAmount / 86400).toFixed(0)
        res.data.list[i].productAmount = ''
       }
    }
 }
    let list = JSON.stringify(res.data.list)
    list = formatExportData(JSON.parse(list))
    table2Excel(state.exportConfig, list, getFormatDate()+'订单管理')
    loading.close() // 关闭遮罩层
}

 const formatExportData =  (list) => {
  // 处理特殊字段
  /*
    比如：你请求的数据中的age返回的是1或者2，其1代表“男”2代表“女”
    导出表格时，总不能以1和2的方式展示，此方法用于处理特殊字段
  */
  list.forEach((item) => {
    state.formatColumns.forEach((i) => {
      item[i.prop] = i.option[item[i.prop]]
    })
    for (let key in item) {
      if (!item[key] && item[key] == null) {
        item[key] = ""
      }
    }
  });
  return list
}
const getFormatDate =  () => {
    var date = new Date();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentDate = date.getFullYear() + "-" + month + "-" + strDate
            + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
    return currentDate;
}

</script>

<style>


</style>
